package com.ice.base.controller;

import com.ice.base.model.SysPermissionModel;
import com.ice.base.service.SysPermissionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;

@RestController
@ApiIgnore(value = "系统后台-权限管理")
public class SysPermissionController extends BaseController {

    //---------------------------权限-----------------------start
    @Resource
    private SysPermissionService sysPermissionService;

    @ApiOperation(value = "权限-插入")
    @PostMapping("/base/SysPermission/insert")
    public HashMap insert_SysPermission(HttpServletRequest request,SysPermissionModel model) {
        return insert(request, sysPermissionService, model);
    }

    @ApiOperation(value = "权限-删除")
    @PostMapping("/base/SysPermission/deleteById")
    public HashMap deleteById_SysPermission(@RequestParam("id") String id) {
        return delete(sysPermissionService, id);
    }

    @ApiOperation(value = "权限-更新")
    @PostMapping("/base/SysPermission/updateById")
    public HashMap update_SysPermission(HttpServletRequest request) {
        return update(request, sysPermissionService, new SysPermissionModel());
    }

    @ApiOperation(value = "权限-查询一个")
    @PostMapping("/base/SysPermission/selectById")
    public HashMap selectById_SysPermission(@RequestParam("id") String id) {
        return selectById(sysPermissionService, id);
    }

    @ApiOperation(value = "权限-查询多个")
    @PostMapping("/base/SysPermission/selectList")
    public HashMap selectList_SysPermission(HttpServletRequest request) {
        return selectListByCondition(request, sysPermissionService, new SysPermissionModel());
    }

    @ApiOperation(value = "权限-查询分页")
    @PostMapping("/base/SysPermission/selectListByPageHelper")
    public HashMap selectListByPageHelper_SysPermission(HttpServletRequest request,
                                                        @RequestParam(name = "pageSize") Integer pageSize,
                                                        @RequestParam(name = "pageNum") Integer pageNum,
                                                        SysPermissionModel model) {
        return selectListByPageHelper(request, sysPermissionService,model);
    }


    //---------------------------权限-----------------------end

}
